# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=kwave
pkgver=22.04.3
pkgrel=0
# armhf blocked by extra-cmake-modules
# s390x and riscv64 blocked by polkit -> kio
arch="all !armhf !s390x !riscv64"
url="http://kwave.sourceforge.net/"
pkgdesc="A sound editor for KDE"
license="GPL-2.0-or-later"
makedepends="
	alsa-lib-dev
	audiofile-dev
	extra-cmake-modules
	fftw-dev
	flac-dev
	imagemagick
	karchive-dev
	kcompletion-dev
	kconfig-dev
	kconfigwidgets-dev
	kcoreaddons-dev
	kcrash-dev
	kdbusaddons-dev
	kdoctools-dev
	ki18n-dev
	kiconthemes-dev
	kio-dev
	kservice-dev
	ktextwidgets-dev
	kwidgetsaddons-dev
	kxmlgui-dev
	libsamplerate-dev
	libvorbis-dev
	opus-dev
	pulseaudio-dev
	qt5-qtbase-dev
	qt5-qtmultimedia-dev
	samurai
	"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/release-service/$pkgver/src/kwave-$pkgver.tar.xz"
subpackages="$pkgname-libs $pkgname-doc $pkgname-lang"

build() {

	if [ "$CARCH" = s390x ]; then
		doc_opts="-DWITH_DOC=OFF"
	else
		doc_opts="-DWITH_DOC=ON"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DWITH_OSS=OFF \
		-DWITH_MP3=OFF \
		$doc_opts
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
7dd6e3ef76371d750619e6d2c8c55cea2c3e727b1a6f552ecc4a9318181488af99eb7a01912407945a74b5c7c80c66dcee01a5facf2743e9aea43d0391b7ba2d  kwave-22.04.3.tar.xz
"
